package cmd;

import data.Data_Canvas;
import tree.LeafKind;

//给一个像素点着色
class Cmd_DrawPixel extends Cmd {
    var x : Int;
    var y : Int;
    var layer : Int;
    public var ocolor : Int;
    public var ncolor : Int;
    

    public function new(x, y, layer, color) {
        super();
        this.x = x;
        this.y = y;
        this.layer = layer;
        this.ncolor = color;
    }

    //相当于命令的执行
    public override function Do() {
        ocolor = data_canvas.ChangeColor(x, y, layer, ncolor);
    }

    //相当与命令的撤销
    public override function Undo() {
        data_canvas.SetColor(x, y, layer, ocolor);
    }
}